/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ar.uba.fi.rsajapplet.controller;

import ar.uba.fi.rsajapplet.view.ModePanel;
import ar.uba.fi.rsajapplet.view.EvaluationPanel;
import ar.uba.fi.rsajapplet.view.LearningPanel;
import java.awt.CardLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JPanel;

/**
 *
 * @author marcelo
 */
public class RSAJApplet extends JApplet {

    private ActionListener modeActionListener;
    private ActionListener learningActionListener;
    private ActionListener evaluationActionListener;
    private JPanel cards;
    private JPanel modePanel;
    private JPanel learningPanel;
    private JPanel evaluationPanel;
       
    public void init() {
        
        this.cards = new JPanel(new CardLayout());
        
        this.modeActionListener = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                CardLayout cl = (CardLayout)(cards.getLayout());
                cl.show(cards, "MODE");
            }
        };
        
        this.learningActionListener = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                CardLayout cl = (CardLayout)(cards.getLayout());
                cl.show(cards, "LEARNING");
            }
        };
        
        this.evaluationActionListener = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                CardLayout cl = (CardLayout)(cards.getLayout());
                cl.show(cards, "EVALUATION");
            }
        };
        
        this.modePanel = new ModePanel(learningActionListener, evaluationActionListener);
        this.learningPanel = new LearningPanel(modeActionListener);
        this.evaluationPanel = new EvaluationPanel();
        
        
        cards.add(modePanel, "MODE");
        cards.add(learningPanel, "LEARNING");
        cards.add(evaluationPanel, "EVALUATION");
        setContentPane(cards);
        resize(700,400);
    }
}
